<?
include "DB/Database.class.php";
include "Grid.class.php";
include "GridPager.class.php";
include "GridSource.class.php";
include "GridLinker.class.php";
include "GridSearcher.class.php";
include "GridSorter.class.php";
include "GUI/HtmlLink.class.php";
include "GUI/ComboBox.class.php";

$sql = "SELECT
  socios.id,
  CONCAT(SUBSTR(CONCAT(socios.nombre,' ', apellido_paterno, ' ',apellido_materno ),1,25),'...') Socio,
  grupo_sanguineo,
  fecha_nacimiento,
  membresias.nombre membresia,
  socios.email Email
FROM
  socios, membresias
WHERE
  socios.membresia_id = membresias.id";	
  
  #echo GridSorter::SortQuery($sql, $_REQUEST[order]);

$g = new Grid();
GridDataSource::Fill($g, GridSorter::SortQuery($sql, $_REQUEST[order]));

$a = new htmlLink("#","Perfil",0,"?id=","newWindow('../ver_perfil.php?id=*','windowTittle')");
$b = new htmlLink("../update/socios.php?id=","Editar",0,"", "");
$c = new htmlLink("../delete/socios.php?tabla=socios&redirect=../select/socios.php&id=", "Eliminar", 0, "", "");
$links = array($a, $b, $c);


echo GridSorter::Render($g->grid, DataBase::FieldsName($sql), $links);


#GridSearcher::Render($sql);
#echo GridLinker::Render($g->grid, $links);

#echo GridPager::GetNavigationControlsHTML($sql, 20); 

#echo GridSearcher::SearchString($sql, $grid_search_field, $grid_search_value);
?>